package com.example.student.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.student.entity.EduCourse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface EduCourseMapper extends BaseMapper<EduCourse> {
    
    /**
     * 统计教师待录入成绩的课程数量
     */
    @Select("SELECT COUNT(*) FROM edu_course c " +
            "LEFT JOIN edu_score s ON c.id = s.course_id " +
            "WHERE c.teacher_id = #{teacherId} " +
            "AND c.status = 1 " +
            "AND s.id IS NULL")
    int countPendingScores(Long teacherId);
} 